﻿<Button x:Class="WindowButton"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    SnapsToDevicePixels="True"
    x:Name="myUcName">
    
    <Button.Resources>
        
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="buttonIcons.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <LinearGradientBrush x:Key="DefaultBackgroundBrush" StartPoint="0,0" EndPoint="0,1">
                <GradientStop Color="#ede2f3" Offset="0" /><!--212 E2EAF3 // 279 ede2f3-->
                <GradientStop Color="#d4c3dc" Offset="0.45" /><!--214 C3CEDC // 281 d4c3dc-->
                <GradientStop Color="#b9a2c4" Offset="0.45" /><!--214 A2B1C4 // 281 b9a2c4-->
                <GradientStop Color="#d1b4db" Offset="1" /><!--217 B4C3DB // 284 d1b4db-->
            </LinearGradientBrush>
        </ResourceDictionary>        
    </Button.Resources>
    <Button.Template>
        <ControlTemplate TargetType="Button">
            <Border x:Name="MainBorder" BorderBrush="{TemplateBinding BorderBrush}" 
                    BorderThickness="1,0,1,1" CornerRadius="{Binding ElementName=myUcName, Path=CornerRadius}"
                    Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" 
                    Background="{TemplateBinding Background}">
                <Grid>
                    <Border x:Name="HighlightBorder" CornerRadius="{Binding ElementName=myUcName, Path=CornerRadius}">
                        <ContentControl x:Name="ContentPlaceHolder" Content="{Binding ElementName=myUcName, Path=ActiveContent}" Margin="0,-1,0,0" />
                    </Border>
                    <Border x:Name="WhiteBorder" BorderBrush="#88FFFFFF" BorderThickness="1,0,1,1"
                            CornerRadius="{Binding ElementName=myUcName, Path=CornerRadius}" />
                </Grid>
            </Border>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter TargetName="HighlightBorder" 
                            Property="Background" 
                            Value="{Binding Path=Foreground, RelativeSource={RelativeSource TemplatedParent}}" />
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
    </Button.Template>
    <Button.Style>
        <Style TargetType="Button">
            <Setter Property="Width" Value="26" />
            <Setter Property="Height" Value="16" />
            <Setter Property="BorderBrush" Value="#4C5258" />
            <Setter Property="Background" Value="{DynamicResource DefaultBackgroundBrush}" />
            <Setter Property="Foreground">
                <Setter.Value>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                        <GradientStop Color="#cdade8" Offset="0" /> <!--206 ADCEE8 // 273 cdade8-->
                        <GradientStop Color="#9e70c7" Offset="0.45" /> <!--205 70A3C7 // 272 9e70c7-->
                        <GradientStop Color="#641ea5" Offset="0.45" /> <!--204 1E6FA5 // 271 641ea5-->
                        <GradientStop Color="#6927b4" Offset="0.80" /> <!--201 2782B4 // 268 6927b4-->
                        <GradientStop Color="#3217fb" Offset="1" /> <!--180 17FBFA // 247 -->
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
        </Style>
    </Button.Style>
</Button>

